Skip to content

Feat/account linking improvements#2506

Merged
chaitanyapotti merged 11 commits into
masterfrom
feat/account-linking-improvements
May 28, 2026
Merged

Feat/account linking improvements#2506
chaitanyapotti merged 11 commits into
masterfrom
feat/account-linking-improvements

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented May 27, 2026

Jira Link

Description

Miscellaneous improvements on Account Linking feature:

  • proper error handling
  • error codes with informative messages
  • handle disconnect after the account link failures
  • de-duplicate primary linked accounts in the LinkedAccounts list (Please refer to this commit f593f50)
  • fixed wagmi rehydration issue for the linked accounts
  • cached projectConfig for linked injected wallets rehydration
  • refactor some account link utils from Core classes

How has this been tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Note

Medium Risk
Touches session rehydration, Wagmi binding, and wallet disconnect on link failure—user-visible connection/account-switch behavior, though changes are mostly defensive with new test coverage.

Overview
This PR tightens account linking end-to-end: AccountLinkingError and helpers (formatAccountLinkingErrorMessage, getAccountLinkingRequestError) move into @web3auth/no-modal/account-linking, with richer Citadel/API failures (e.g. 409 already registered) and consistent modal error text. The modal caches projectConfig on init for linked-wallet rehydration; core rehydrates linked wallets, emits CONNECTION_UPDATED, and disconnects the linking wallet after a failed link.

Linked account lists from AUTH now filter duplicate primaries for other chain namespaces and hide account_abstraction rows. MetaMask maps user rejections to WalletOperationsError.userRejected and avoids spurious disconnects when not connected.

Wagmi (React/Vue, modal + no-modal) no longer gates binding on the primary connector name; it syncs on provider + connectorName and skips reconnect when already bound—fixing rehydration for linked EVM accounts. Lockfiles bump @metamask/connect-* packages; new tests cover account-linking errors/REST.

Reviewed by Cursor Bugbot for commit f4de37f. Bugbot is set up for automated code reviews on this repo. Configure here.

@lwin-kyaw lwin-kyaw requested review from a team as code owners May 27, 2026 14:26
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web3auth-web Ready Ready Preview, Comment May 28, 2026 6:12am

Request Review

Comment thread packages/no-modal/src/base/errors/index.ts
Comment thread packages/no-modal/src/account-linking/vue.ts Outdated
Comment thread packages/no-modal/src/account-linking/errors.ts
Comment thread packages/no-modal/src/connectors/auth-connector/authConnector.ts
Comment thread packages/no-modal/src/connectors/metamask-connector/metamaskConnector.ts Outdated
Comment thread packages/no-modal/src/noModal.ts
return result;
} catch (err) {
setError(err as Web3AuthError);
throw err;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you never throw error in hooks

} catch (err) {
log.error("Error linking account", err);
error.value = err as Web3AuthError;
throw err;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never throw error in composables

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6c19b6d. Configure here.

Comment thread packages/no-modal/src/vue/wagmi/provider.ts
@chaitanyapotti chaitanyapotti merged commit 168889f into master May 28, 2026
6 of 7 checks passed
@chaitanyapotti chaitanyapotti deleted the feat/account-linking-improvements branch May 28, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants